//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
extends /admin/include/layout.pug
block content
    .row: .col-lg-12
        h1.site-h1(style='background-color:#FFFFFF;')
            | 短信网关列表 #{smsList.totalElements}
            span(style='float:right;')
                button.layui-btn.layui-btn-small.green(href='/admin/sms/add.html', data-toggle='ajax', data-width='550', data-height='450', data-title='创建新短信网关')
                    | 创建新短信网关

        .row(style='padding:5px;')
            .col-lg-12
                table.layui-table(lay-skin='line')
                    colgroup
                        col(width='10%')
                        col(width='15%')
                        col(width='10%')
                        col(width='15%')
                        col(width='10%')
                        col(width='10%')
                        col(width='20%')
                        col(width='1%')
                    thead
                        tr
                            th 名称
                            th 短信网关类型
                            th 访问的URL
                            th 模板ID
                            th AppKey
                            th 参数
                            th 创建时间
                            th(style='white-space:nowrap;', nowrap) 操作
                    tbody
                        for sms in smsList.content
                            tr
                                td= sms.name
                                td= uKeFuDic[sms.smstype]
                                td= sms.url
                                td= sms.tpcode
                                td= sms.appkey
                                td= sms.moreparam
                                td= pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', sms.createtime)
                                td(style="white-space:nowrap;" nowrap="nowrap")
                                    a(href="/admin/sms/edit.html?id=" + sms.id, data-toggle="ajax",  data-width="550", data-height="450", data-title="编辑短信服务器")
                                        i.layui-icon &#xe642;
                                        span 编辑
                                    a(href="/admin/sms/delete.html?id=" + sms.id style="margin-left:10px;" data-toggle="tip"  title="请确认是否删除短信服务器？")
                                        i.layui-icon(style="color:red;") &#x1006;
                                        span 删除
        .row(style='padding:5px;')
            .col-lg-12#page(style='text-align:center;')

    script.
        layui.use(['laypage', 'layer'], function () {
            var laypage = layui.laypage
                , layer = layui.layer;

            laypage({
                cont: 'page'
                // ,pages: <#if smsList??>${smsList.totalPages}<#else>0</#if> //总页数
                // ,curr:<#if smsList??>${smsList.number+1}<#else>0</#if>
                , groups: 5 //连续显示分页数
                , jump: function (data, first) {
                    if (!first) {
                        location.href = "/admin/sms/index.html?p=" + data.curr;
                    }
                }
            });
        });

